// Copyright (C) 2023 即时通讯网(52im.net) & Jack Jiang.
// The RainbowChat Project. All rights reserved.
// 
// 【本产品为著作权产品，合法授权后请放心使用，禁止外传！】
// 【本次授权给：<北京小羊驼科技有限公司>，授权编号：<NT231212144350>，代码指纹：<A.702363430.550>，技术对接人微信：<ID: wxid_wbyootvkdcgj22>】
// 【授权寄送：<收件：苏先生、地址：北京市大兴区北京密码西区6号楼1单元301、电话：18613885610、邮箱：bd@huiyuanxiang-inc.com>】
// 
// 【本系列产品在国家版权局的著作权登记信息如下】：
// 1）国家版权局登记名(简称)和权证号：RainbowChat    （证书号：软著登字第1220494号、登记号：2016SR041877）
// 2）国家版权局登记名(简称)和权证号：RainbowChat-Web（证书号：软著登字第3743440号、登记号：2019SR0322683）
// 3）国家版权局登记名(简称)和权证号：RainbowAV      （证书号：软著登字第2262004号、登记号：2017SR676720）
// 4）国家版权局登记名(简称)和权证号：MobileIMSDK-Web（证书号：软著登字第2262073号、登记号：2017SR676789）
// 5）国家版权局登记名(简称)和权证号：MobileIMSDK    （证书号：软著登字第1220581号、登记号：2016SR041964）
// * 著作权所有人：江顺/苏州网际时代信息科技有限公司
// 
// 【违法或违规使用投诉和举报方式】：
// 联系邮件：jack.jiang@52im.net
// 联系微信：hellojackjiang
// 联系QQ号：413980957
// 授权说明：http://www.52im.net/thread-1115-1-1.html
// 官方社区：http://www.52im.net
package com.x52im.mall;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

import com.x52im.mall.logic.shop.GoodDetailActivity;
//import com.x52im.mall.logic.shop.GoodDetailDetailActivity;
//import com.x52im.mall.logic.shop.GoodDetailDetailWebActivity;
//import com.x52im.mall.logic.shop.GoodDetailEvaluateActivity;
//import com.x52im.mall.logic.shop.GoodDetailPortalActivity;
import com.x52im.mall.logic.shop.OrderComfirmActivity;
import com.x52im.mall.logic.shop.OrderConfirmCommentActivity;
import com.x52im.mall.logic.shop.OrderConfirmDetailActivity;
import com.x52im.mall.logic.shop.OrderConfirmShippingAddressActivity;
import com.x52im.mall.logic.shop.ShopCarActivity;
import com.eva.epc.common.util.CommonUtils;
import com.x52im.mall.score.dto.TokenRechangeHistory;
import com.x52im.mall.shop.dto.Device;
import com.x52im.mall.shop.dto.SO;
import com.x52im.mall.shop.dto.SOConsigneeInfo;
import com.x52im.mall.shop.dto.SODetail;

public class IntentFactory
{
	/**
	 * 打开OrderConfirmShippingAddressActivity的Intent构造方法.
	 * 
	 * @param thisActivity
	 * @return
	 */
	public static Intent createOrderConfirmShippingAddressActivityIntent(Context thisActivity, SOConsigneeInfo dataForInit)
	{
		Intent intent = new Intent(thisActivity, OrderConfirmShippingAddressActivity.class);
		if (dataForInit != null)
			intent.putExtra("__dataForInit__", dataForInit);
		return intent;
	}

	/**
	 * 解析intent传过来给OrderConfirmShippingAddressActivity的数据.
	 * 
	 * @param intent
	 * @return
	 */
	public static SOConsigneeInfo parseOrderConfirmShippingAddressActivityIntent(Intent intent)
	{
		return (SOConsigneeInfo) intent.getSerializableExtra("__dataForInit__");
	}

	/**
	 * 打开ShopCarActivity的Intent构造方法.
	 * 
	 * @param thisActivity
	 * @return
	 */
	public static Intent createShopCarActivityIntent(Context thisActivity)
	{
		Intent intent = new Intent(thisActivity, ShopCarActivity.class);
		return intent;
	}

	/**
	 * 打开OrderComfirmActivity的Intent构造方法.
	 * 
	 * @param thisActivity
	 * @return
	 */
	public static Intent createOrderComfirmActivityIntent(Context thisActivity)
	{
		Intent intent = new Intent(thisActivity, OrderComfirmActivity.class);
		return intent;
	}

	public static Intent createOrderComfirmCommentActivityIntent(Context thisActivity, SODetail soDetail)
	{
		Intent intent = new Intent(thisActivity, OrderConfirmCommentActivity.class);
		intent.putExtra("__sodetail__", soDetail);
		return intent;
	}

	public static SODetail parseOrderComfirmCommentActivityIntent(Intent intent)
	{
		return (SODetail) intent.getSerializableExtra("__sodetail__");
	}

	public static Intent createOrderComfirmDetailActivityIntent(Context thisActivity, SO so)
	{
		Intent intent = new Intent(thisActivity, OrderConfirmDetailActivity.class);
		intent.putExtra("__so__", so);
		return intent;
	}

	public static SO parseOrderComfirmDetailActivityIntent(Intent intent)
	{
		return (SO) intent.getSerializableExtra("__so__");
	}

//	public static Intent createGoodDetailPortalActivityIntent(Context thisActivity, Device goodInfo)
//	{
//		Intent intent = new Intent(thisActivity, GoodDetailPortalActivity.class);
//		if (goodInfo != null)
//			intent.putExtra("__goodInfoForInit__", goodInfo);
//		return intent;
//	}

	/**
	 * 打开GoodDetailActivity的Intent构造方法.
	 * 
	 * @param thisActivity
	 * @param goodInfo
	 * @return
	 */
	public static Intent createGoodDetailActivityIntent(Context thisActivity, Device goodInfo)
	{
		Intent intent = new Intent(thisActivity, GoodDetailActivity.class);
		if (goodInfo != null)
			intent.putExtra("__goodInfoForInit__", goodInfo);
		return intent;
	}

	/**
	 * 解析intent传过来给GoodDetailActivity的数据.
	 * 
	 * @param intent
	 * @return
	 */
	public static Device parseGoodDetailActivityIntent(Intent intent)
	{
		return (Device) intent.getSerializableExtra("__goodInfoForInit__");
	}

//	public static Intent createGoodDetailDetailWebActivityIntent(Context thisActivity, Device goodInfo)
//	{
//		Intent intent;
//		if (goodInfo != null && !CommonUtils.isStringEmpty(goodInfo.getDevice_detail_url()))
//		{
//			intent = new Intent(thisActivity, GoodDetailDetailWebActivity.class);
//			intent.putExtra("__deviceDetailUrl__"
//					, MallGlobal.getMallProviderInstance(thisActivity).getRobotimeMall().getNoNeedAuthedService().getServletRootURL()
//						+ goodInfo.getDevice_detail_url());
//		}
//		else
//		{
//			intent = new Intent(thisActivity, GoodDetailDetailActivity.class);
//		}
//
//		return intent;
//	}

//	public static String parseGoodDetailDetailActivityIntent(Intent intent)
//	{
//		return intent.getStringExtra("__deviceDetailUrl__");
//	}

//	public static Intent createGoodDetailEvaluateActivityIntent(Context thisActivity, Device goodInfo)
//	{
//		Intent intent = new Intent(thisActivity, GoodDetailEvaluateActivity.class);
//		if (goodInfo != null)
//			intent.putExtra("__goodInfoForInit__", goodInfo);
//		return intent;
//	}
//
	/**
	 * @param thisActivity
	 * @param url
	 * @return
	 */
	public static Intent createWebPostActivityIntent(Activity thisActivity, String url, String data)
	{
		Intent intent = new Intent(thisActivity, WebPostActivity.class);
		intent.putExtra("__url__", url);
		intent.putExtra("__data__", data);
		return intent;
	}
	
	public static ArrayList parseWebPostActivityIntent(Intent intent)
	{
		ArrayList datas = new ArrayList();
		datas.add(intent.getStringExtra("__url__"));
		datas.add(intent.getStringExtra("__data__"));
		return datas;
	}
	
	
	/**
	 * @param thisActivity
	 * @param url
	 * @return
	 */
	public static Intent createPaymentActivityIntent(Activity thisActivity, SO so, TokenRechangeHistory history, String rechargeType)
	{
		Intent intent = new Intent(thisActivity, CommonPaymentActivity.class);
		intent.putExtra("__so__", so);
		intent.putExtra("__history__", history);
		intent.putExtra("__recharge_type__", rechargeType);
		return intent;
	}
	
	public static ArrayList parsePaymentActivityIntent(Intent intent)
	{
		ArrayList datas = new ArrayList();
		datas.add(intent.getSerializableExtra("__so__"));
		datas.add(intent.getSerializableExtra("__history__"));
		datas.add(intent.getStringExtra("__recharge_type__"));
		return datas;
	}

}
